import service from ".";
import {LoginFormInt} from "@/type/login";

// 活动查询数据接口
interface SelectData {
    name: string;
    page: number;
    pageSize: number;
    type: string;
    scope: string;
}

//用户通过学号登录接口
export const loginByStudentId = (data: LoginFormInt) => {
    return service({
        url: "/user/user/login",
        method: "post",
        data
    })
};


//用户获取活动列表
export const getActivityList = (data:SelectData) => {
    return service({
        url: "/user/active/page",
        method: "get",
        params:data,
    })
};

//用户查看活动详情
export const getActivityDetail = (activeId:number) => {
    return service({
        url: "/user/active/detail",
        method: "get",
        params:{activeId}
    })
};

//查看该活动有多少人提交材料
export const getSubmitList = (activeId:number) => {
    return service({
        url: "/user/active/submitDetail",
        method: "post",
        params:{activeId}
    })
};

// 用户上传活动材料
export const uploadMaterial = (activeId: number, userId: number, file: File) => {
    const formData = new FormData();
    formData.append('file', file);
    return service({
        url: "/user/material/upload",
        method: "post",
        data: formData,
        params: { activeId, userId } // 将 activeId 和 userId 作为查询参数传递
    })
};

